using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using David.CanBus;
using MessagePack;
namespace XaDevice
{
    [MessagePackObject]
    public class NetworkCanDevice
    {
        [Key(0)]
        public string DevicePath { get; set; }
        [Key(1)]
        public bool IsOpen { get; set; }
        [Key(2)]
        public DeviceInfo_t DeviceInfo { get; set; }
    }
    public interface IDeviceManager
    {
        Task<List<NetworkCanDevice>> GetDevices();
    }
    public interface IMisc
    {
        Task<Version> GetXaDeviceServerVersion();
        Task         SetAppDllName(string appDllName);
    }
    public delegate Task NetworkCanDeviceEventNotify(string devicePath, UInt32 evLen, DeviceEvent_t[] eve);
    public delegate void NetworkCanDeviceHotPlug(List<NetworkCanDevice> deviceInfos);
    [MessagePackObject]
    public class RequestHardwareTimeStamp
    {
        [Key(0)]
        public UInt64 HardwareTimeStamp { get; set; }
        [Key(1)]
        public DateTime PcRequestDateTimeStamp { get; set; }
    }
    public interface IDevice
    {
        Task<string> GetLicenseString(string appDllName,string devicePath,string appname,UInt32 a3);
        Task<bool> Open(string appDllName, string devicePath);
        Task<bool> Close(string appDllName, string devicePath);
        Task<bool> Configure(string appDllName, string devicePath, byte channelIndex, CanDeviceConfig_t config);
        Task<CanDeviceConfig_t> GetConfigure(string appDllName, string devicePath, byte channelIndex);

        Task<UInt32> SendCanXFrame(string appDllName, string devicePath, UInt32 count, CANX_Packet_t[] tx);

        Task<RequestHardwareTimeStamp> GetTimeStamp(string appDllName, string devicePath);
        Task<bool> SetCanDeviceRunState(string appDllName, string devicePath,bool isStart);

        Task<byte[]> SignatureData(string devicePath, byte[] align32Data);

    }
}
